package com.hui.mapper;

import com.hui.entity.Menu;
import com.hui.entity.Product;
import com.hui.vo.ProductVo;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

/**
 * @Description
 */
public class ProductVoMapper implements RowMapper<ProductVo> {
    @Override
    public ProductVo rowToEntity(ResultSet rs) {
        ProductVo productVo = null;
        try {
            int productId = rs.getInt("productId");
            String productName = rs.getString("productName");
            int categoryId = rs.getInt("categoryId");
            int productNum = rs.getInt("productNum");
            String productDesc = rs.getString("productDesc");
            Date createTime = rs.getDate("createTime");
            String status = rs.getString("status");
            int warehouseId = rs.getInt("warehouseId");
            String categoryName = rs.getString("categoryName");
            String warehouseName = rs.getString("warehouseName");

            productVo = new ProductVo(productId, productName, categoryId, productNum, productDesc, createTime, status, warehouseId, categoryName, warehouseName);
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return productVo;
    }
}
